﻿using System;
using System.Web.Core;

namespace Yuanlin.Business
{
    public class NoNegativeValidator : IDataValidator
    {
        #region IDataValidator 成员

        public bool Validate(object parameter)
        {
            if (parameter == null)
            {
                return false;
            }
            try
            {
                int? value = Globals.ConvertType<int?>(parameter);
                return value.HasValue && value.Value > -1;
            }
            catch
            {
                return false;
            }
        }

        #endregion
    }
}
